<template>
	<view>
		<!--  class="main" -->

		<!-- <img class="zuo" src="@/static/zuo.png" alt=""> -->

		<!-- <view style="width: 100vw; height: 100vh;">
			<img style="width: 100%; height: 100%;" src="https://boyaltd.oss-cn-hangzhou.aliyuncs.com/zhongqiu2023/hxcs.png" alt="">
		</view> -->

		<view :class="pick_name == '本部' ? 'leixing' : 'qita'" style="">
			<!-- <scroll-view :scroll-x="true" class="scrollview-box" @scroll="scroll" :scroll-left="scrollLeft2"> -->
			<block v-for="(item, idx) in list" :key="item.id">
				<view class="item">
					<view :class="pick_name==item.name?'yes':'no'" @tap="leixing(item.id, item.name)">
						{{item.name}}
					</view>
				</view>
			</block>
			<!-- </scroll-view> -->
		</view>

		<view class="content" v-if="this_index == 79">
			<img :src="list[0].init_index[0].imgs" alt="">
		</view>

		<view class="content" v-if="this_index == 80">
			<img :src="list[1].init_index[0].imgs" alt="">
		</view>

		<view class="content" v-if="this_index == 81">
			<img :src="list[2].init_index[0].imgs" alt="">
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				scrollLeft2: null,
				pick_name: '',
				this_index: 79,
				list: [],
				peizhi: [{
						id: 1,
						name: '本部',
						img: 'https://boyaltd.oss-cn-hangzhou.aliyuncs.com/zhongqiu2023/liugang.jpg'
					},
					{
						id: 2,
						name: '广钢',
						img: 'https://boyaltd.oss-cn-hangzhou.aliyuncs.com/zhongqiu2023/guanggang.jpg'
					}, {
						id: 3,
						name: '中金',
						img: 'https://boyaltd.oss-cn-hangzhou.aliyuncs.com/zhongqiu2023/zhongjin.jpg'
					},
				]
			}
		},
		onLoad() {
			this.data_list();
			this.pick_name = '本部'
		},
		methods: {
			data_list() {
				var self = this
				self.$boya.Request({
					url: '/api/activity/article',
					data: {
						type: 15,
					}
				}, function(res) {
					let data = res.data.data
					for (var i = 0; i < data.length; i++) {
						// console.log('shuju: ', data[i]);
						let init = data[i].init_index
						for (var j = 0; j < init.length; j++) {
							if (init[j].imgs) {
								let img = init[j].imgs.substring(2, init[j].imgs.length - 2);
								// console.log('img：', img);
								init[j].imgs = img
							}
						}
					}
					self.list = data
					console.log('shuju: ', self.list);
				}, false)
			},
			scroll(e) {
				// console.log(e)
				this.scrollLeft = e.detail.scrollLeft
			},
			leixing(id, name) {
				this.pick_name = name
				this.this_index = id
			},
		}
	}
</script>

<style>
	.main {
		/* background-color: #941F26; */
	}

	.zuo {
		position: absolute;
		width: 80rpx;
		left: 180rpx;
		/* top: 100rpx; */
	}

	.content {
		width: 100vw;
		height: 100vh;
	}

	.content>img {
		width: 100%;
		/* height: 100%; */
	}

	.shenbao {
		width: 100%;
		margin: 0 auto;
		display: flex;
		align-items: center;
		margin-top: 100rpx;
	}

	.shenbao>view {
		height: 55rpx;
		line-height: 55rpx;
		padding: 10rpx 35rpx 0 35rpx;
		padding-bottom: 10rpx;
		font-size: 30rpx;
		border-radius: 20rpx;
		margin-left: 35rpx;
	}

	.this_bg {
		color: white;
		background-color: #F78D1C;
	}

	.defu_bg {
		color: #F78D1C;
		background-color: white;
	}

	.scrollview-box {
		/* 滚动必须加的属性 */
		white-space: nowrap;
		width: 100%;
		padding: 20rpx 20rpx 20rpx 20rpx;
	}

	/* .item {
		margin-top:50rpx;
		margin-right: 40rpx;
		item的外层定义成行内元素才可进行滚动 inline-block / inline-flex 均可
		display: inline-flex;
		flex-direction: column;
		align-items: center;
	} */

	.leixing {
		padding-top: 50rpx;
		padding-bottom: 50rpx;
		display: flex;
		justify-content: space-around;
		/* background-color: #67C6F8; */
		background: linear-gradient(to right, #A4D9F8, #67C6F8, #A4D9F8);
	}

	.qita {
		padding-top: 50rpx;
		padding-bottom: 50rpx;
		display: flex;
		justify-content: space-around;
		/* background-color: #67C6F8; */
		background: linear-gradient(to right, #A4D9F8, #67C6F8, #A4D9F8);
	}

	.item>view {
		padding: 15rpx 55rpx;
		font-size: 35rpx;
		text-align: center;
		border: 1px solid #FDEBCF;
		border-radius: 20rpx;
		box-shadow: 0 5rpx 5rpx 1rpx #B3CEE9;
	}

	.yes {
		/* width: 230rpx; */
		color: white;
		background-color: #5059A0;
	}

	.no {
		/* width: 230rpx; */
		color: #97A1C5;
		background-color: white;
	}
</style>